name: Manual Test Reporting

permissions:
  contents: read

on:
  workflow_dispatch:
 
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npm install jest-junit
      - run: npm test -- --coverage --reporters=default --reporters=jest-junit --coverageReporters=clover

      - name: Testspace client install & config
        uses: testspace-com/setup-testspace@v1
        with:
          domain: ${{github.repository_owner}}
      - name: Testspace push test content
        run: testspace "[${{ github.workflow }}/${{ github.job}}] ./junit.xml"
      - name: Coveralls GitHub Action
        uses: coverallsapp/github-action@v2.3.6
      - name: Upload coverage reports to Codecov
        uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
      - name: Upload test results to Codecov
        if: ${{ !cancelled() }}
        uses: codecov/test-results-action@v1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
